import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import { AlertController } from '@ionic/angular';
import { BaseUiService } from '../../../services/base-ui.service';
import { NotarizationInfoService } from '../../../services/notarization-info.service';

@Component({
  selector: 'app-goflow',
  templateUrl: './goflow.page.html',
  styleUrls: ['./goflow.page.scss'],
})
export class GoflowPage implements OnInit {
  public isXuanz:boolean = false; //是否勾选
  public showFuwu:boolean = false;
  constructor(
    public baseUiService:BaseUiService,
    public router: Router,
    public NotarizationInfoService:NotarizationInfoService,
    private activatedRoute: ActivatedRoute,
    public alertController: AlertController
  ) {}

  ngOnInit() {
    this.presentAlert()
  }
  //弹出是否代办
  async presentAlert() {
    const alert = await this.alertController.create({
      header: '是否代办',
      subHeader: '',
      message: '你是否为代理办理公证的事项的，如果是请选择是，否则就选择否',
      backdropDismiss: false,
      buttons: [
        {
          text: '否',
          handler: () => {
            this.NotarizationInfoService.setisDaiBan(0)
          }
        },
        {
          text: '是',
          handler: () => {
            this.NotarizationInfoService.setisDaiBan(1)
          }
        }
      ]
    });

    await alert.present();
  }
  //开始申办
  gonotayconter(){
    // console.log(this.isXuanz)
    if(this.isXuanz){
      this.router.navigate(['/transaction/notayconter'])
    }else{
      this.baseUiService.showToast("请同意协议",'customblue','top')
    }
  }
}
